/* eslint valid-jsdoc: "off" */

"use strict";

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = (appInfo) => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = (exports = {});

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + "_1616929066652_1495";

  // add your middleware config here
  // config.middleware = ["timelog"];
  // timelog: {
  //   match: "/time";
  // }
  exports.multipart = {
    mode: "file",
  };
  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };
  config.security = {
    csrf: {
      headerName: "x-csrf-token", // 自定义请求头
    },
  };

  // 模板引擎配置
  config.view = {
    defaultExtension: ".nj",
    defaultViewEngine: "nunjucks",
    mapping: {
      ".nj": "nunjucks",
      ".hbs": "handlebars",
      ".ejs": "ejs",
    },
  };
  return {
    ...config,
    ...userConfig,
  };
};
